import dayjs from "dayjs";

export const get729Time = () => {
  let timeList = [];
  let timeType = [
    {
      type: "开始",
      indexTime: 1, // 07-06 00:00
    },
    {
      type: "降雨",
      indexTime: 4, // 07-06 12:00
    },
    {
      type: "降雨增强",
      indexTime: 8, // 07-07 04:00
    },
    {
      type: "产流",
      indexTime: 14, // 07-08 04:00
    },
    {
      type: "河道行洪",
      indexTime: 18, // 07-08 20:00
    },
    // {
    //   type: '溃堤',
    //   indexTime: 25
    // },
    {
      type: "白石港漫堤",
      indexTime: 30, // 07-10 20:00
    },
    {
      type: "泄洪调度",
      indexTime: 40, //07-12 12:00
    },
  ];
  //2019 07-06 时间戳
  const startTime = 1562342400000;
  const yushu = 4;
  for (let i = 0; i < 217; i++) {
    if (i % yushu === 0) {
      timeList.push({
        name: "",
        value: dayjs(startTime).add(i, "hours").format("MM/DD HH:mm"),
      });
    }
  }

  for (let i = 0; i < timeList.length; i++) {
    for (let j = 0; j < timeType.length - 1; j++) {
      if (i + 1 >= timeType[timeType.length - 1].indexTime) {
        timeList[i].name = timeType[timeType.length - 1].type;
        break;
      }
      if (i + 1 >= timeType[j].indexTime && i + 1 < timeType[j + 1].indexTime) {
        timeList[i].name = timeType[j].type;
        break;
      }
    }
  }
  return timeList;
};
